package com.metel.mservice.common.faultcode.message;


/**
 * ErrorMessage
 * 
 * @author sr80.choi
 */
public final class ErrorMessage {

	private final String faultCode;

	private final String message;

	private ErrorMessage(String faultCode, String message) {
		this.faultCode = faultCode;
		this.message = message;
	}

	public String getFaultCode() {
		return faultCode;
	}

	public String getMessage() {
		return FaultCodeResource.createErrorMessage(faultCode, message);
	}

	/**
	 * Create instance from FaultCode
	 * 
	 * @param faultCode
	 * @return
	 */
	public static ErrorMessage fromFaultCode(String faultCode) {
		String message = FaultCodeResource.getMessage(faultCode);

		return new ErrorMessage(faultCode, message);
	}
	
	/**
	 * Create instance from FaultCode
	 * 
	 * @param faultCode
	 * @return
	 */
	public static ErrorMessage fromFaultCode(String faultCode, String message) {
		return new ErrorMessage(faultCode, message);
	}

	/**
	 * Create instance from FaultCode
	 * 
	 * @param faultCode
	 * @param replaceStr
	 * @return
	 */
	public static ErrorMessage fromFaultCode(String faultCode, Object... replaceStr) {
		String message = FaultCodeResource.getMessage(faultCode, replaceStr);

		return new ErrorMessage(faultCode, message);
	}
	public static ErrorMessage fromFaultMessage(String message) {
		

		return new ErrorMessage("", message);
	}
}
